<?php


function FataException($string){
	$error="fatal  error : StringObj $string";
	exit($error);
}


class Object{

public static $TAG="Object";



public function   equal(){


	return true;
}


public function  hashCode(){

	return 11;

}









}
//////////////////////////////////
 class String extends Object{

 	public static $TAG = "String";
 	public $mString="";
 	public $count=0;
////////////////
 	public function  __construct($string ){
 		if(is_string($string)){

 			$mString=$string;
 			$this->count=strlen($string);
 		}else{

 			FataException("arg must be string");
 		}
 		

 	}


 	/////////////

 	public static function getType(){


 		return $TAG;
 	}

  public static function indexOf($source,$target,$startIndex=0){

	if(($result=strpos($source,$target,$startIndex))===false){

		return -1;
	}else{

		return result;
	}
  	
  }

  public function equals($string){

  	if(is_string($string)){

  			if($string === $this->mString){

  				return true;
  			}
  	 }

  	 return false;
  }

  public static function beforeChar($source,$char){


  		$return = strstr($source,$char,true);
  		return $return;
  }

   public static function afterChar($source,$char){

  		$return = strstr($source,$char);
  		$return = substr($return,1);
  		return $return;
  }

  public function length(){

  	return $this->count;
  }



}////end class

$str0=new String("ddd111@qq.com");
echo $str0->length();















?>